package entity;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "Step")
@Entity
@Table(name="t_step")
public class Step extends AbstractEntity {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="step_id")
	private Long id;
	
	@Column(name="step_name", length=100)
	private String name;
	
	@Column(name="step_desc", length=400)
	private String desc;
	
	@Column(name="case_id")
	private Long caseId;
	
	@Column(name="sub_url", length=1000)
	private String url;	
	
	@Column(name="request_method", length=20)
	private String method;	
	
	@Column(name="request_format", length=20)
	private String format;
	

	/*@Transient
	private String request;*/
	
	/*@Column(name="request", length=REQUEST_LENGTH)	
	//private byte[] requestTemplate;
	private String request;//Template;*/
	@Lob
	private String request;
	
	/*@Transient
	private String response;*/
	
	
	/*@Column(name="response", length=RESPONSE_LENGTH)	
	//private byte[] requestExpect;
	private String response;//Expect;*/
	@Lob
	private String response;
	
	
	@Column(name = "header", length = HEADER_LENGTH)
	private String header;
	
	@Override
	public Long getKey() {
		return id;
	}
	
	@Override
	public void acceptValue(AbstractEntity input) {
		if(input!=null && input instanceof Step){
			Step param=(Step)input;
			this.setName(param.getName());
			this.setDesc(param.getDesc());
			this.setUrl(param.getUrl());	
			this.setCaseId(param.getCaseId());
			this.setMethod(param.getMethod());
			this.setFormat(param.getFormat());
			//this.setRequest(param.getRequest());
			//this.setResponse(param.getResponse());
			this.setHeader(param.getHeader());
			this.setResponse(param.getResponse());
			this.setRequest(param.getRequest());
		}
	}
	
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String description) {
		this.desc = description;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Long getCaseId() {
		return caseId;
	}

	public void setCaseId(Long caseId) {
		this.caseId = caseId;
	}

	public String getMethod() {
		return method;
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public String getFormat() {
		return format;
	}

	public void setFormat(String format) {
		this.format = format;
	}

	public String getRequest() {
		return request;
	}

	public void setRequest(String request) {
		this.request = request;
	}

	public String getResponse() {
		return response;
	}

	public void setResponse(String response) {
		this.response = response;
	}


	public String getHeader() {
		return header;
	}


	public void setHeader(String header) {
		this.header = header;
	}

	



	
	
	
}
